package com.example.basewarehouse.net;



import com.example.basewarehouse.bean.WeatherInfo;
import com.example.basewarehouse.mvp.BaseResponse;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * Retrofit 接口请求配置都在这
 * https://blog.csdn.net/guohaosir/article/details/78942485
 */
public interface RetrofitApiService {
    @GET("/api/weather/city/{id}")
    Observable<BaseResponse<WeatherInfo>> getInfo(@Path("id") String filepath);


//    Retrofit 上传文件
    @POST
    @Multipart
    Observable<ResponseBody> uploadPic(@Url String url, @Part("sequence") RequestBody sequence, @Part MultipartBody.Part file);

    //Retrofit下载文件
    @GET
    @Streaming
    //10以上用@streaming。不会造成oom，反正你用就是了
    Observable<ResponseBody> downloadFile(@Url String url);

    @GET
    @Streaming
    Observable<ResponseBody> downloadFile(@Url String url, @Header("RANGE") String range);

}
